
# This file contains methods that draw usefull shapes

import pygame
from pygame import locals

# Draw a rectangle with rounded edges on a new surface
def balloon(w, h, r, c, b = 3):
    """balloon(width, height, radius, color)"""
    s = pygame.Surface((w+2*r+2*b, h+2*r+2*b)).convert_alpha()
    s.fill((0,0,0,0))
    for x, y in ((r+b,r+b), (r+b,h+r+b), (w+b+r, r+b), (w+r+b, h+r+b)):
        pygame.draw.circle(s, (0,0,0), (x, y), r+b)
        pygame.draw.circle(s, c, (x, y), r)
    s.fill((0,0,0), (r+b, 0, w, h+r*2+b*2))    
    s.fill((0,0,0), (0, r+b, w+r*2+b*2, h))
    s.fill(c, (r+b, b, w, h+r*2))    
    s.fill(c, (b, r+b, w+r*2, h))
    return s

# Draw an edge around an image. Returns a new surface
def edge(s, b, c):
    r = s.get_rect()
    n = pygame.Surface((r.width + b, r.height + b)).convert_alpha()
    

